let http = uni.$u

// const BASE_URL = 'https://testdiaodianv2.tikevideos.shop'
const BASE_URL = 'https://www.diaodiandaren.com'

const install = e => {
  http.http.setConfig({
    baseUrl: BASE_URL
  })
  let vkGlobalThis = vk.getGlobalObject()
  if (typeof vkGlobalThis == 'object') vkGlobalThis.api = createApi()
}
// pageNum, pageSize
const createApi = () => ({
  wxPay: params =>
    http.post(`/order/order/wxPayTrade`, params, {
      'content-type': 'application/x-www-form-urlencoded'
    }),

  sendSms: params => http.post(`/api/sms/send`, params, {}),

  smsLogin: params => http.post(`/api/user/smsLogin`, params, {}),

  init: params => http.get(`/api/index/index`, params, {}),

  getUserInfo: params => http.get(`/api/user/getUserInfo`, params, {}),

  basanIndex: params => http.get(`/api/basan/index`, params, {}),

  collect: params => http.post(`/api/basan/addLikeBasan`, params, {}),

  collectList: params => http.get(`/api/basan/getLikeBasan`, params, {}),

  collectDelete: params => http.post(`/api/basan/delLikeBasan`, params, {}),

  deleteBasan: params => http.post(`/api/basan/delete`, params, {}),

  reportBasan: params => http.post(`/api/report/add`, params, {}),

  reportType: params => http.get(`/api/report/getType`, params, {}),

  messageList: params => http.get(`/api/message/index`, params, {}),

  systemMessageList: params => http.get(`/api/message/index`, params, {}),

  getBasanOption: params => http.get(`/api/basan_options/index`, params, {}),

  addBasanOption: params => http.post(`/api/basan_options/create`, params, {}),

  deleteBasanOption: params => http.post(`/api/basan_options/delete`, params, {}),

  getBasanList: params => http.get(`/api/basan/getList`, params, {}),

  getBasanDetail: params => http.get(`/api/basan/getInfo`, params, {}),

  logout: params => http.post(`/api/user/logout`, params, {}),

  addBasan: params => http.post(`/api/basan/create`, params, {}),

  editAvatar: params => http.post(`/api/account/editAvatar`, params, {}),

  editNickname: params => http.post(`/api/account/editNickname`, params, {}),

  getNicknameCount: params => http.get(`/api/account/editNickname`, params, {}),

  getArticleDetail: params => http.get(`/api/cms.article/read`, params, {}),

  deleteAccount: params => http.post(`/api/user/delete`, params, {}),

  changePhone: params => http.post(`/api/user/editMobile`, params, {}),

  feedback: params => http.post(`/api/feedback/create`, params, {}),

  feedbackList: params => http.get(`/api/feedback/index`, params, {}),
  //获取消息统计
  getMessageCount: params => http.get(`/api/notification/total`, params, {}),
  //获取消息列表
  getMessageList: params => http.get(`/api/notification/index`, params, {}),

  mobileLogin: params => http.post(`/api/user/mobileLogin`, params, {}),

  editBasan: params => http.post(`/api/basan/update`, params, {}),

  bindPhone: params => http.post(`/api/user/bindMobile`, params, {}),

  editInfo: params => http.post(`/api/account/profile`, params, {}),
  //获取提现账户信息
  getWithdrawalAccount: params => http.get(`/api/wallet/getAccount`, params, {}),

  bindWithdrawalAccount: params => http.post(`/api/wallet/addAccount`, params, {}),

  unBindWithdrawalAccount: params => http.post(`/api/wallet/delAccount`, params, {}),

  articleList: params => http.get(`/api/cms.article/index`, params, {}),

  joinDaren: params => http.post(`/api/creator/apply`, params, {}),

  joinDarenStatus: params => http.get(`/api/creator/status`, params, {}),

  wallet: params => http.get(`/api/wallet/info`, params, {}),

  applyWithdrawal: params => http.post(`/api/wallet/cash`, params, {}),

  withdrawalList: params => http.get(`/api/wallet/monthLog`, params, {}),

  detailList: params => http.get(`/api/wallet/log`, params, {}),

  deleteMessage: params => http.post(`/api/notification/delete`, params, {}),

  withdrawalProgress: params => http.get(`/api/wallet/cashProgress`, params, {}),

  saveDraft: params => http.post(`/api/draft/create`, params, {}),

  getFishOptions: params => http.get(`/api/fish_options/index`, params, {}),

  getDraftList: params => http.get(`/api/draft/getList`, params, {}),

  deleteDraft: params => http.post(`/api/draft/delete`, params, {}),

  getDraftTotal: params => http.get(`/api/user/getTotal`, params, {}),

  updateDraft: params => http.post(`/api/draft/update`, params, {}),

  getBoughtList: params => http.get(`/api/basan/buy`, params, {}),

  getSearchHistory: params => http.get(`/api/basan/historySearch`, params, {}),

  getSearchList: params => http.get(`/api/basan/search`, params, {}),

  getOtherHome: params => http.get(`/api/user/home`, params, {}),

  getCommentList: params => http.get(`/api/comment/index`, params, {}),

  addComment: params => http.post(`/api/comment/create`, params, {}),

  deleteComment: params => http.post(`/api/comment/delete`, params, {}),

  commentLike: params => http.post(`/api/comment/like`, params, {}),

  commentUnLike: params => http.post(`/api/comment/unlike`, params, {}),

  getDiamondList: params => http.get(`/api/wallet/getDiamondPrice`, params, {}),

  createOrder: params => http.post(`/api/order/rechargeDiamond`, params, {}),

  getPayParams: params => {
    return http.get(`/api/pay/paymentDiamond`, params, {})
  },

  blackUser: params => http.post(`/api/blacklist/blockUser`, params, {}),

  unBlackUser: params => http.post(`/api/blacklist/unblockUser`, params, {}),

  blacklist: params => http.get(`/api/blacklist/blacklist`, params, {}),

  notInterest: params => http.post(`/api/basan/uninterested`, params, {}),

  soldList: params => http.get(`/api/basan/solds`, params, {}),

  estimateIncome: params => http.get(`/api/wallet/estimate`, params, {}),

  unlockBasan: params => http.post(`/api/order/createOrderV2`, params, {}),

  wechatLogin: params => {
    return http.post(`/api/user/wechatLogin`, params, {})
  },

  getWeather: params => http.get(`/api/weather/info`, params, {}),

  applePay: params => {
    return http.post(`/api/PayNotify/appleiap`, params, {})
  },

  setMessage: params => http.post(`/api/user/setNoticeStatus`, params, {}),

  appleLogin: params => {
    return http.post(`/api/user/appleLogin`, params, {})
  },

  refreshToken: params => {
    return http.post(`/api/common/refreshToken`, params, {})
  },

  isReturnMessage: params => http.get(`/api/feedback/hasUnread`, params, {})
})
export default install
